package com.lgq.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.lgq.dao.CollegeDAO;
import com.lgq.model.College;
import com.lgq.service.CollegeService;
import com.lgq.util.Page;
@Component("collegeService")
public class CollegeServiceImpl implements CollegeService {
	private CollegeDAO collegeDAO;
	public CollegeDAO getCollegeDAO() {
		return collegeDAO;
	}
	@Resource
	public void setCollegeDAO(CollegeDAO collegeDAO) {
		this.collegeDAO = collegeDAO;
	}
	@Override
	public Page<College> getAllCollege(int currentPage, int numPerPage) {
		// TODO Auto-generated method stub
		return this.collegeDAO.getAllCollege(currentPage, numPerPage);
	}
	@Override
	public boolean ifCollegeNameExist(String name) {
		if(this.collegeDAO.findByName(name)!=null)
		{
			return true;			
		}
		return false;
	}
	@Override
	public boolean ifCollegeVolIdEsist(String volid) {
		if(this.collegeDAO.findByVolId(volid)!=null)
		{
			return true;
		}
		return false;
	}
	@Override
	public boolean addCollege(College college) {
		// TODO Auto-generated method stub
		return this.collegeDAO.addCollege(college);
	}
	@Override
	public boolean updateCollege(College college) {
		// TODO Auto-generated method stub
		return this.collegeDAO.updateCollege(college);
	}
	@Override
	public boolean deleteCollege(int id) {
		// TODO Auto-generated method stub
		return this.collegeDAO.deleteCollege(id);
	}
	@Override
	public College findCollegeById(int id) {
		// TODO Auto-generated method stub
		return this.collegeDAO.findCollegeById(id);
	}
	public List<College> findAllCollege()
	{
		return this.collegeDAO.findAllCollege();
	}
}
